<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="utf-8">
    <title>币拍</title>
    <meta name="renderer" content="webkit">
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
    <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
    <meta name="apple-mobile-web-app-status-bar-style" content="black">
    <meta name="apple-mobile-web-app-capable" content="yes">
    <meta name="format-detection" content="telephone=no">

    <link rel="stylesheet" href="plugins/layui/css/layui.css" media="all" />
    <link rel="stylesheet" href="css/global.css" media="all">
    <link rel="stylesheet" href="plugins/font-awesome/css/font-awesome.min.css">
</head>
<body>
<div class="layui-container" style="width: 80%">
    <form class="layui-form">
        <div class="layui-row" style="margin-top: 50px">
            <fieldset class="layui-elem-field" style="margin-top: 20px">
                <legend style="font-weight: bold;font-size: 40px">区块信息</legend>
                <div class="layui-col-md12" style="font-size: 25px">
                    <div class="layui-form-item">
                        <div class="layui-inline">
                            <label class="layui-form-label" style="width:400px">
                                block_num_or_id：
                            </label>
                            <div class="layui-input-inline" style="width: 500px;">
                                <input name="server_version" class="layui-input" style="width: 450px">
                                <button id="findblock" class="layui-btn layui-btn-normal">查询</button>
                            </div>
                        </div>
                    </div>
                    <div class="layui-form-item">
                        <div class="layui-inline">
                            <label class="layui-form-label" style="width:400px">
                                previous：
                            </label>
                            <div class="layui-input-inline" style="width: 500px;">
                                <input name="previous" class="layui-input">
                            </div>
                        </div>
                    </div>
                    <div class="layui-form-item">
                        <div class="layui-inline">
                            <label class="layui-form-label" style="width:400px">
                                timestamp：
                            </label>
                            <div class="layui-input-inline" style="width: 500px;">
                                <input name="timestamp" class="layui-input">
                            </div>
                        </div>
                    </div>
                    <div class="layui-form-item">
                        <div class="layui-inline">
                            <label class="layui-form-label" style="width:400px">
                                transaction_merkle_root：
                            </label>
                            <div class="layui-input-inline" style="width: 500px;">
                                <input name="transaction_merkle_root" class="layui-input">
                            </div>
                        </div>
                    </div>
                    <div class="layui-form-item">
                        <div class="layui-inline">
                            <label class="layui-form-label" style="width:400px">
                                producer：
                            </label>
                            <div class="layui-input-inline" style="width: 500px;">
                                <input name="producer" class="layui-input">
                            </div>
                        </div>
                    </div>
                    <div class="layui-form-item">
                        <div class="layui-inline">
                            <label class="layui-form-label" style="width:400px">
                                producer_changes：
                            </label>
                            <div class="layui-input-inline" style="width: 500px;">
                                <input name="producer_changes" class="layui-input">
                            </div>
                        </div>
                    </div>
                    <div class="layui-form-item">
                        <div class="layui-inline">
                            <label class="layui-form-label" style="width:400px">
                                producer_signature：
                            </label>
                            <div class="layui-input-inline" style="width: 500px;">
                                <input name="producer_signature" class="layui-input">
                            </div>
                        </div>
                    </div>
                    <div class="layui-form-item">
                        <div class="layui-inline">
                            <label class="layui-form-label" style="width:400px">
                                cycles：
                            </label>
                            <div class="layui-input-inline" style="width: 500px;">
                                <input name="cycles" class="layui-input">
                            </div>
                        </div>
                    </div>
                    <div class="layui-form-item">
                        <div class="layui-inline">
                            <label class="layui-form-label" style="width:400px">
                                id：
                            </label>
                            <div class="layui-input-inline" style="width: 500px;">
                                <input name="id" class="layui-input">
                            </div>
                        </div>
                    </div>
                    <div class="layui-form-item">
                        <div class="layui-inline">
                            <label class="layui-form-label" style="width:400px">
                                block_num：
                            </label>
                            <div class="layui-input-inline" style="width: 500px;">
                                <input name="block_num" class="layui-input">
                            </div>
                        </div>
                    </div>
                    <div class="layui-form-item">
                        <div class="layui-inline">
                            <label class="layui-form-label" style="width:400px">
                                ref_block_prefix：
                            </label>
                            <div class="layui-input-inline" style="width: 500px;">
                                <input name="ref_block_prefix" class="layui-input">
                            </div>
                        </div>
                    </div>
                </div>
            </fieldset>
        </div>
    </form>
</div>
<script type="text/javascript" src="./js/config.js"></script>
<script type="text/javascript" src="plugins/layui/layui.js"></script>
<script type="text/javascript">
    layui.use(['table','jquery','element'],function () {
        var $ = layui.$;
        var table = layui.table;
        var element = layui.element;

        $('#findblock').on('click', function () {
            var jsons = {};
            jsons.block_num_or_id = $('input[name="block_num_or_id"]').val();
            $.ajax({
                url: contextPath1 + "chain/block",
                type: "POST",
                contentType: "application/json;charset=utf-8",
                dataType: "json",
                data: JSON.stringify(jsons),
                success: function (data) {
                    $('input[name="previous"]').attr("value", data.previous);
                    $('input[name="timestamp"]').attr("value", data.timestamp);
                    $('input[name="transaction_merkle_root"]').attr("value", data.transaction_merkle_root);
                    $('input[name="producer"]').attr("value", data.producer);
                    $('input[name="producer_changes"]').attr("value", data.producer_changes);
                    $('input[name="producer_signature"]').attr("value", data.producer_signature);
                    $('input[name="cycles"]').attr("value", data.cycles);
                    $('input[name="id"]').attr("value", data.id);
                    $('input[name="block_num"]').attr("value", data.block_num);
                    $('input[name="ref_block_prefix"]').attr("value", data.ref_block_prefix);
                },
                error: function () {
                }
            });
        });
    });
</script>
</body>
</html>